#include "MvpPanel.h"
#include <QHBoxLayout>
#include <QVBoxLayout>
CMvpPanel::CMvpPanel(QWidget *parent) : QWidget(parent)
{
    this->setWindowFlags(Qt::FramelessWindowHint);
    this->setAttribute(Qt::WA_TranslucentBackground);

    QVBoxLayout *vLayout = new QVBoxLayout(this);
    vLayout->setSpacing(0);
    vLayout->setMargin(0);
    this->setLayout(vLayout);

    m_pLabel = new CComboTextLabel(this);
    m_pLabel->setFixedSize(44,12);

    m_pMvpHeadIcon = new CPKMvpWidget(this);
    m_pMvpHeadIcon->setHeadIcon(":/headicon.png");
    m_pMvpHeadIcon->setHeadBorderIcon(":/kl_icon_mvp_trophy_get_not.png");
    m_pMvpHeadIcon->setFixedSize(38,25);

    QFrame* tFrame = new QFrame(this);
    tFrame->setStyleSheet("background-color:red;");
    QHBoxLayout *hLayout = new QHBoxLayout(tFrame);
    hLayout->setSpacing(0);
    hLayout->setMargin(0);
    tFrame->setLayout(hLayout);
    hLayout->addWidget(m_pMvpHeadIcon);
    vLayout->addWidget(tFrame);

    QFrame* bFrame = new QFrame(this);
    QHBoxLayout *hLayout2 = new QHBoxLayout(bFrame);
    hLayout2->setSpacing(0);
    hLayout2->setMargin(0);
    bFrame->setLayout(hLayout2);
    hLayout2->addWidget(m_pLabel);
    vLayout->addWidget(bFrame);
}

void CMvpPanel::UpdateHeadIcon(QString path)
{
    if(path.isEmpty())
        m_pMvpHeadIcon->setHeadIcon(":/headicon.png");
    else
        m_pMvpHeadIcon->setHeadIcon(path);
}

void CMvpPanel::UpdateHeadBorder(QString path)
{
    if(path.isEmpty())
        m_pMvpHeadIcon->setHeadBorderIcon(":/kl_icon_mvp_trophy_get_not.png");
    else
        m_pMvpHeadIcon->setHeadBorderIcon(path);
}

void CMvpPanel::UpdateText(QString str,bool isNum)
{
    m_pLabel->SetText(str,isNum);
}
